package com.nanjia.boot.config;

import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.springframework.context.annotation.Configuration;

import java.security.Security;

/**
 * 补充了这个试试
 * cn.hutool.crypto.CryptoException: NoSuchAlgorithmException: class configured for MessageDigest (provider: BC) cannot be found.
 * @author 周洋
 * @since Created in 2025 2025/9/4 12:08
 */
@Configuration
public class CryptoConfig {

    static {
        // 确保BouncyCastle提供者被注册
        if (Security.getProvider("BC") == null) {
            Security.addProvider(new BouncyCastleProvider());
        }
    }
}
